﻿namespace OnlineVideos.RingToneEditor
{
    using System;
    using System.Runtime.InteropServices;

    //[StructLayout(LayoutKind.Sequential, Pack=2)]
    public class Mp3WaveFormat : WaveFormat
    {
        private const short Mp3WaveFormatExtraBytes = 12;
        public Mp3WaveFormatId id;
        public Mp3WaveFormatFlags flags;
        public ushort blockSize;
        public ushort framesPerBlock;
        public ushort codecDelay;
        public Mp3WaveFormat(int sampleRate, int channels, int blockSize, int bitRate)
        {
            base.waveFormatTag = WaveFormatEncoding.MpegLayer3;
            base.channels = (short) channels;
            base.averageBytesPerSecond = bitRate / 8;
            base.bitsPerSample = 0;
            base.blockAlign = 1;
            base.sampleRate = sampleRate;
            base.extraSize = 12;
            this.id = Mp3WaveFormatId.Mpeg;
            this.flags = Mp3WaveFormatFlags.PaddingIso;
            this.blockSize = (ushort) blockSize;
            this.framesPerBlock = 1;
            this.codecDelay = 0;
        }
    }
}

